<template>
    <div>
        <!-- 搜索容器 -->
        <div class="search-container">
            <span class="search-label">菜单名称：</span>
            <el-input v-model="input" placeholder="搜索菜单" class="search-input"></el-input>

            <el-button type="primary" class="search-button">查询</el-button>
            <el-button type="success" class="search-button">重置</el-button>
        </div>

        <el-select v-model="value" placeholder="请选择" class="search-select">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
        </el-select>


        <el-table :data="tableData" border style="width: 100%; margin-top: 15px;"
            :header-cell-style="{ textAlign: 'center', background: '#f5f7fa', fontWeight: 'bold' }"
            :cell-style="{ textAlign: 'center' }">

            <!-- 第一列：菜单id -->
            <el-table-column prop="menuId" label="菜单ID" width="120"></el-table-column>

            <!-- 第二列：菜单名称 -->
            <el-table-column prop="menuName" label="菜单名称" width="180"></el-table-column>

            <!-- 第三列：菜单所属父级id -->
            <el-table-column prop="parentId" label="父级ID" width="120"></el-table-column>

            <!-- 第四列：状态 -->
            <el-table-column prop="status" label="状态" width="120">
                <template slot-scope="scope">
                    <el-tag :type="scope.row.status === '启用' ? 'success' : 'danger'">
                        {{ scope.row.status }}
                    </el-tag>
                </template>
            </el-table-column>

            <!-- 第五列：操作 -->
            <el-table-column label="操作" width="200" fixed="right">
                <template slot-scope="scope">
                    <el-button @click="handleEdit(scope.row)" type="text" size="small">编辑</el-button>
                    <el-button @click="handleDelete(scope.row)" type="text" size="small"
                        style="color:#f56c6c">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <!-- 分页组件 -->
        <el-pagination class="pagination-left" background layout="prev, pager, next" :total="1000"></el-pagination>
    </div>
</template>

<script>
export default {
    methods: {
        handleEdit(row) {
            console.log('编辑', row);
        },
        handleDelete(row) {
            console.log('删除', row);
        }
    },
    data() {
        return {
            input: '',
            tableData: [
                {
                    menuId: '1001',
                    menuName: '系统管理',
                    parentId: '0',
                    status: '启用'
                },
                {
                    menuId: '1002',
                    menuName: '用户管理',
                    parentId: '1001',
                    status: '启用'
                },
                {
                    menuId: '1003',
                    menuName: '角色管理',
                    parentId: '1001',
                    status: '禁用'
                },
                {
                    menuId: '1004',
                    menuName: '权限管理',
                    parentId: '1001',
                    status: '启用'
                }
            ]
        }
    }
}
</script>

<style>
/* 搜索容器样式 */
.search-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
}

.search-label {
    white-space: nowrap;
    font-size: 14px;
    color: #606266;
}

.search-input {
    width: 200px;
}

.search-button {
    margin-left: 10px;
}

/* 表格样式 */
.el-table th {
    height: 60px;
    padding: 10px 0;
}

.el-table {
    margin-top: 15px;
    font-size: 14px;
}

/* 状态标签样式 */
.el-table .el-tag {
    padding: 0 12px;
    height: 28px;
    line-height: 28px;
}

/* 操作按钮样式 */
.el-table .el-button--text {
    margin: 0 5px;
    font-size: 13px;
}

/* 分页样式 */
.pagination-left {
    margin-top: 15px;
    text-align: left;
}
</style>